|
|
|
|
|
|
|
Notice some error-checking code in the GraphType property Let method. This checks for a valid graph type and reports an error if a valid value is not found. |
|
|
|
|
|
|
|
|
Now add the code from Listing 11.15 to the Class_Initialize event. This sets the default values for the properties. |
|
|
|
|
|
|
|
|
Listing 11.15. Coding the Class_Initialize event. |
|
|
|
|
|
|
|
|
Private Sub Class_Initialize()
'
' set startup values
'
strDBName = ""
strSQLSelect = ""
strFieldPoint = ""
strTitle = "Data Graph"
intGraphType = gphBar3D
'
End Sub |
|
|
|
|
|
|
|
|
Now you're ready to code the ShowGraph method. This one method collects all the property values, creates a dataset, and builds a graph based on the data. Create a Public Sub called ShowGraph in the class and add the code from Listing 11.16. |
|
|
|
|
|
|
|
|
Listing 11.16. Coding the ShowGraph method. |
|
|
|
|
|
|
|
|
Public Sub ShowGraph()
'
' display graph
'
On Error GoTo LocalErr
'
Screen.MousePointer = vbHourglass
OpenDB
InitGraph
LoadGraphData
Screen.MousePointer = vbNormal
'
frmGraph.Graph1.DrawMode = gphDraw
frmGraph.Show vbModal
'
Exit Sub
'
LocalErr:
Err.Raise vbObjectError + 4, App.EXEName, "Error displaying graph"
'
End Sub |
|
|
|
|
|